package com.wlgc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wlgc.dao.CourseDao;
import com.wlgc.entity.Course;
import com.wlgc.entity.RestBean;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class CourseServiceImpl {
    LambdaQueryWrapper<Course> wrapper;
    @Resource
    CourseDao dao;
    public RestBean getAllCourse(){
        wrapper=new LambdaQueryWrapper<>();
        wrapper.select(Course::getName);
      return  new RestBean<>(200,"", dao.selectList(wrapper));
    }
    public String getCid(String name){
        wrapper=new LambdaQueryWrapper<>();
        wrapper.eq(Course::getName,name);
        return dao.selectOne(wrapper).getCid().toString();

    }
}
